package com.sczmgk.hotline_pzh.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.View;

import com.sczmgk.hotline_pzh.R;
import com.sczmgk.hotline_pzh.base.WebViewBaseActivity;
import com.sczmgk.hotline_pzh.constants.Constants;
import com.sczmgk.hotline_pzh.dialog.DialogFactory;
import com.sczmgk.hotline_pzh.utils.MyToast;

/**
 * Created by Administrator on 2016/12/28.
 */
public class BannerDetailActivity extends WebViewBaseActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setHeader();

        initView();

    }

    private void setHeader() {
        setTitle(R.string.banner_title);
        setLeftBtnVisibility(View.VISIBLE);
    }

    @Override
    protected String getUrl() {
        Intent intent = getIntent();
        String urlPath = intent.getStringExtra(Constants.BANNER_DETAIL_INFO);
        return urlPath;
    }

    @Override
    protected void onWebViewPageStarted() {
        // 展示加载的dialog
        loadingDialog = DialogFactory.getLoadingDialog(BannerDetailActivity.this);
        DialogFactory.showDialog(loadingDialog);
    }

    @Override
    protected void onWebViewPageFinished() {
        //当页面加载完成时关闭dialog
        DialogFactory.dismissLoadingDialog(loadingDialog);
    }

    @Override
    protected void onWebViewReceivedError() {
        //当页面加载失败时关闭dialog并弹吐司
        DialogFactory.dismissLoadingDialog(loadingDialog);
        MyToast.show(BannerDetailActivity.this, "网络有问题,请检查网络");
    }


    @Override
    public void handleMessage(Message msg) {

    }

    @Override
    public boolean getIsNeedLogin() {
        return false;
    }
}
